package gx.illnessRecord.service.Impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import gx.illness.entity.Illness;
import gx.illness.mapper.IllnessMapper;
import gx.illness.service.IllnessService;
import gx.illnessRecord.entity.IllnessRecord;
import gx.illnessRecord.mapper.IllnessRecordMapper;
import gx.illnessRecord.service.IllnessRecordService;
import gx.util.DateUtil;
import gx.util.Formats;

@Service
public class IllnessRecordServiceImpl implements IllnessRecordService{

	@Autowired
	private IllnessRecordMapper illnessRecordMapper;
	
	@Override
	public IllnessRecord getIllnessRecordById(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<IllnessRecord> getIllnessRecordList() {
		// TODO Auto-generated method stub
		return illnessRecordMapper.getIllnessRecordList();
	}

	@Override
	public int add(IllnessRecord illnessRecord) {
		// TODO Auto-generated method stub
		if( Formats.isEmpty( illnessRecord.getId() ) ){
			illnessRecord.setId( UUID.randomUUID().toString() );
		}
		
		//获取当前时间日历 格式为(yyyy-m-d)
		illnessRecord.setRecordDate(DateUtil.getStringDateShort());
		
		return illnessRecordMapper.add(illnessRecord);
	}

	@Override
	public int update(String id, IllnessRecord illnessRecord) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delete(String id) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public IllnessRecord queryNowTimeHasRecord(String nowTime) {
		// TODO Auto-generated method stub
		return illnessRecordMapper.queryNowTimeHasRecord(nowTime);
	}

	
	
	
}
